#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

bool isMatch(const char *s, const char *p) {
    if (!*p) return *s == '\0';
    
    if (*(p+1) != '*') {
        return (((*p == *s) || (*p == '.' && *s != '\0')) && isMatch(s+1, p+1));
    }

    while((*s == *p) || (*p == '.' && *s != '\0')) {
        if (isMatch(s, p+2)) return true;
        s++;
     }

    return isMatch(s, p+2);
}
                                

int main(int argc, char **argv)
{

    cout << "-----------------Test 1--------------------" << endl;
    cout << isMatch("aaa", "ab*a") << endl;

    cout << "-----------------Test 2--------------------" << endl;


    cout << "-----------------Test 3--------------------" << endl;


    cout << "-----------------Test 4--------------------" << endl;


    cout << "-----------------Test 5--------------------" << endl;



}
